var newMovie1Show = {
    init: function () {
        is_log();
        var user_id = -1;
        if ($('#user_id').text()!=-1){
            user_id = $('#user_id').text();
        }
        new_movie_show();
        setTimeout(function(){
        hot_movie_show();
        },100);
        setTimeout(function(){
            choice_movie();
        },300);
        setTimeout(function(){
        recomment_movie(user_id);
        },450);
        trainsition();
        login();
        register();
        setTimeout(function(){
        hot_picture();
        },500);
        refer();
        login_out();

}
};

//模态框提交图片识别
function refer() {
    $('#refer').click(function () {
        $('#m2').click();
        var value = $("input[name='types']:checked").val();
        var jsonObj = 1;
        if(value == '1'){
            var data = new FormData();
            data.append('types', value);
            data.append('img', $("#img_content")[0].files[0]);
            $.ajax({
                async:false,
                cache: false,
                type: 'POST',
                data:  data,
                mimeType: "multipart/form-data",
                url: '/explore/recognition/',
                // traditional:true, //为必须内容 　　
                processData: false, //为必须内容
                contentType: false, //为必须内容
                success: function(data, status) {
                   jsonObj = JSON.parse(data);
                   refer_message(jsonObj)
            },
        });
        }
        else {
            var imgs = $("#img_content").val();
            $.post('/explore/recognition/', {'img':imgs, 'types': value}, function (data, status) {
                    jsonObj = JSON.parse(data);
                    refer_message(jsonObj)
                })
            };

    })
}

//图片返回信息处理
function refer_message(jsonObj){
    var status1 = jsonObj['status'];
    if(status1 == 200){
        var info = jsonObj['info'];
        var movie_id = info['movie_id'];
        var person = info['persons'];
        var persons = person.join(',');
        if (persons != null) $('#person_name').text(persons);
        else $('#person_name').text('未识别到人物');
        $.get('/movie/info_media/',{'mid': movie_id, 'type': 0}, function (data,status) {
            var jsonObj = JSON.parse(data);
            var movie_name = jsonObj['info']['movie_name'];
            if(movie_name != null)
            {
                $('#movie_name').text(movie_name);
                $('#movie_name').attr('href','/movie/single/?movie_id='+ movie_id);
            }
            else $('#movie_name').text('暂无此电影信息');
        });
        $('.b_close').click(function () {
            $('#movie_name').text('正在识别');
            $('#person_name').text('正在识别');
        })
    }
    else {
        $('#person_name').text('未识别到人物');
        $('#movie_name').text('暂无此电影信息');
    }
}

//检测用户是否已登录
function is_log() {
    $.get('/user/session_get/', function (data, status) {
    var jsonObj = JSON.parse(data);
    var code = jsonObj['status'];
    if (code == '200'){
        $('.img1').attr("src", jsonObj['info']['avatar']);
        $('.welcome').text('欢迎您：'+ jsonObj['info']['name']);
        $('.welcome').css('display','');
        $('.login-out').css('display','');
        $('.login1').css('display', 'none');
        $('.register1').css('display','none');
    }
});
}

//用户登录成功信息刷新
function login_right(user_id) {
    $.get('/user/user_avatar/',{'user_id':user_id},function (data,status) {
                    var jsonObj1 = JSON.parse(data);
                    var avatar = jsonObj1['avatar'];
                    $('.img1').attr("src", avatar);
                    $('.welcome').text('欢迎您：'+ jsonObj1['name']);
                    $('.welcome').css('display','');
                    $('.login-out').css('display','');
                    $('.login1').css('display', 'none');
                    $('.register1').css('display','none');
                });
}

//用户注销
function login_out() {
        $('.login-out').click(function () {
            $.get('/user/log_out/',function (data,status) {
                if (data == '1') {
                    alert('注销成功');
                    // _this.els.user_id.text(-1);
                    // _this.els.user_name.text('用户名');
                    // _this.els.avatar.css("background-image","url(/static/images/m2/avator.png)");
                    $("#img1").attr("src", "/static/images/m2/avator.png" );
                    $('.welcome').css('display','none');
                    $('.login-out').css('display','none');
                    $('.login1').css('display', '');
                    $('.register1').css('display','');
                }
                else alert('注销失败');
            })
    });
}

//用户注册
function register() {
        $('#register-click').click(function () {
        var username = $('#username1').val();
        var password = $('#password1').val();
        var name = $('#name').val();
        var email = $('#email').val();
        $.post('/user/regist_user/',{'username':username,'password':password,'name':name,'email':email,},function (data, status) {
            var jsonObj = JSON.parse(data);
            var code = 0;
            code = jsonObj['code'];
            if(code==-1){
                $('.tip1').text(jsonObj['text']);
            }
            else{
                $('#myModal5').css('display','none');
                $('.modal-backdrop').removeClass();
                $('.modal-open').removeClass();
                alert('注册成功，请登录');
            }
        })
    })
}

//用户登录
function login() {
    $('#login-click').click(function () {
        var username = $('#username').val();
        var password = $('#password').val();
        $.post('/user/login_user/',{'username':username,'password':password},function (data, status) {
            var jsonObj = JSON.parse(data);
            var code = 0;
            code = jsonObj['code'];
            if(code==-1){
                $('.tip').text(jsonObj['text']);
            }
            else{
                recomment_movie(jsonObj['user_id']);
                //刷新用户信息
                login_right(jsonObj['user_id']);
                $('#myModal4').css('display','none');
                $('.modal-backdrop').removeClass();
                $('.modal-open').removeClass();
            }
        })
    })
}

//热门图片信息
function hot_picture() {
     $.get('/picture/hot_picture/', function (data,status) {
    var jsonObj = JSON.parse(data);
    var movie = jsonObj['info'];
    $("#hot_picture1").html('');
    var temp = movie[0];
    var info = temp['information'];
    if(info.length>=100) info = info.substring(0, 99) + '...';
    var htmltr = '  <a href="/picture/single/?pid='+ temp['id'] +'"> <div class="video-grid-single-page-agileits movie_click">\n' + '<span style="display: none;">'+ temp['id'] +'</span>' +
        '        <div data-video="f2Z65fobH2I" id="video" style="height: 510px; overflow: hidden; "><img\n' +
        '                src="'+ temp['url'] +'" alt=""\n' +
        '                class="img-responsive" /></div>\n' +
        '    </div></a>\n' +
        '    <div class="player-text">\n' +
        '        <p class="fexi_header">'+ temp['movie_name'] +'</p>\n' +
        '        <p class="fexi_header_para"><span\n' +
        '                class="conjuring_w3">电影简介<label>:</label></span>'+ info +'</p>\n' +
        '        <p class="fexi_header_para"><span>上映日期<label>:</label></span>\n' +
        '            '+ temp['release_date'] +' </p>\n' +
       '        <p class="fexi_header_para"><span>导演<label>:</label></span>\n' +
        '            '+ temp['directors'] +'w</p>\n' +
        '        <p class="fexi_header_para fexi_header_para1">\n' +
        '            <span>电影评分<label>:</label></span>\n'
        var s1,s2,s3;
        var score = Math.floor(temp['score']);
        s1 = Math.floor(score/2);
        s2 = score - s1*2;
        s3 = 5 - s1 - s2;
        for(var j=0; j<5; j++){
            if (s1>0){
                htmltr = htmltr + '<a href="#"><i class="fa fa-star" aria-hidden="true"></i></a>\n';
                s1--;
            }
            else if(s2>0){
                htmltr = htmltr + '<a href="#"><i class="fa fa-star-half-o" aria-hidden="true"></i></a>\n';
                s2--;
            }
            else {
                htmltr = htmltr + '<a href="#"><i class="fa fa-star-o" aria-hidden="true"></i></a>\n';
                s3--;
            }
        };
        htmltr = htmltr +
        '        </p>\n' +
        '    </div>';
    $("#hot_picture1").append(htmltr);
    $("#hot_pictures").html('');
    for (var i = 1; i <= 8; i++) {
        var temp = movie[i];
        var htmltr = '<div class="w3l-movie-gride-agile movie_click">\n' + '<span style="display: none;">'+ temp['id'] +'</span>' +
            '        <a href="/picture/single/?pid='+ temp['id'] +'" class="hvr-sweep-to-bottom"><img src="'+ temp['url'] +'" title="Movies Pro"\n' +
            '                                                               class="img-responsive" alt=" " style=" width: 250px;height: 290px;">\n' +
            '            <div class="w3l-action-icon"><i class="fa fa-play-circle-o" aria-hidden="true"></i></div>\n' +
            '        </a>\n' +
            '        <div class="mid-1 agileits_w3layouts_mid_1_home">\n' +
            '            <div class="w3l-movie-text">\n' +
            '                <h6><a href="/movie/single/?movie_id='+ temp['id'] +'">'+ temp['movie_name'] +'</a></h6>\n' +
            '            </div>\n' +
            '            <div class="mid-2 agile_mid_2_home">\n' +
            '                <p>'+ temp['release_date'] +'</p>\n' +
            '                <div class="block-stars">\n' +
            '                    <ul class="w3l-ratings">\n';
        var s1,s2,s3;
        var score = Math.floor(temp['score']);
        s1 = Math.floor(score/2);
        s2 = score - s1*2;
        s3 = 5 - s1 - s2;
        for(var j=0; j<5; j++){
            if (s1>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star" aria-hidden="true"></i></a></li>\n';
                s1--;
            }
            else if(s2>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-half-o" aria-hidden="true"></i></a></li>\n';
                s2--;
            }
            else {
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-o" aria-hidden="true"></i></a></li>\n';
                s3--;
            }
        };
        htmltr = htmltr + '                    </ul>\n' +
        '                </div>\n' +
        '                <div class="clearfix"></div>\n' +
        '            </div>\n' +
        '        </div>\n' +
        '        <div class="ribben">\n' +
        '            <p>HOT</p>\n' +
        '        </div>\n' +
        '    </div>';
        $("#hot_pictures").append(htmltr);
            };

});
}


//精选电影滚动
function trainsition() {
    var owl_width1 = 278;
    var owl_width=0;
    window.setInterval(function () {
        if(owl_width>278*4){
            owl_width = 0 ;
            $('.owl-wrapper').css('transform','translate3d(0px, 0px, 0px)');
        }
        $('.owl-wrapper').css('transform','translate3d(-'+ owl_width +'px, 0px, 0px)');
        owl_width = owl_width + owl_width1;
        $('.owl-prev').click(function () {
            if (owl_width>0){
                 owl_width = owl_width - owl_width1;
            $('.owl-wrapper').css('transform','translate3d(-'+ owl_width +'px, 0px, 0px)');
            }
        });
        $('.owl-next').click(function () {
            if (owl_width<278*4){
                 owl_width = owl_width + owl_width1;
                 $('.owl-wrapper').css('transform','translate3d(-'+ owl_width +'px, 0px, 0px)');
            }
        });
    },2000);
};

//用户个性化推荐电影
function recomment_movie(user_id) {
    $.get('/movie/recommend_movie',{'user_id':user_id}, function (data,status) {
        var jsonObj = JSON.parse(data);
        var movie = jsonObj['info'];

        $('.movie_recomment').html('');
        for(var i=0; i<10; i++){
            temp = movie[i];
            var htmltr = '<div class="col-md-2 w3l-movie-gride-agile requested-movies movie_click">\n' + '<span style="display: none;">'+ temp['id'] +'</span>'  +
                '    <a href="/movie/single/?movie_id='+ temp['id'] +'" class="hvr-sweep-to-bottom"><img src="'+ temp['url'] +'" title="Movies Pro" class="img-responsive"\n' +
                '                                                           alt=" ">\n' +
                '        <div class="w3l-action-icon"><i class="fa fa-play-circle-o" aria-hidden="true"></i></div>\n' +
                '    </a>\n' +
                '    <div class="mid-1 agileits_w3layouts_mid_1_home">\n' +
                '        <div class="w3l-movie-text">\n' +
                '            <h6><a href="/movie/single/?movie_id='+ temp['id'] +'">'+ temp['movie_name'] +'</a></h6>\n' +
                '        </div>\n' +
                '        <div class="mid-2 agile_mid_2_home">\n' +
                '            <p>'+ temp['release_date'] +'</p>\n' +
                '            <div class="block-stars">\n' +
                '                <ul class="w3l-ratings">\n'
                var s1,s2,s3;
        var score = Math.floor(temp['score']);
        s1 = Math.floor(score/2);
        s2 = score - s1*2;
        s3 = 5 - s1 - s2;
        for(var j=0; j<5; j++){
            if (s1>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star" aria-hidden="true"></i></a></li>\n';
                s1--;
            }
            else if(s2>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-half-o" aria-hidden="true"></i></a></li>\n';
                s2--;
            }
            else {
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-o" aria-hidden="true"></i></a></li>\n';
                s3--;
            }
        };
        htmltr = htmltr +
                '                </ul>\n' +
                '            </div>\n' +
                '            <div class="clearfix"></div>\n' +
                '        </div>\n' +
                '    </div>\n' +
                '</div>'
        $('.movie_recomment').append(htmltr);
        }
    })
}

//精选电影
function choice_movie() {
    $.get('/movie/choice_movie',function (data,status) {
        var jsonObj = JSON.parse(data);
        var movie = jsonObj['info'];
        $(".owl-wrapper").html('');
        for(var i=0; i<9; i++){
            temp = movie[i];
            var htmltr = '<div class="owl-item movie_click" style="width: 278px;">' + '<span style="display: none;">'+ temp['id'] +'</span>'  +
                '<div class="item ">\n' +
                '    <div class="w3l-movie-gride-agile w3l-movie-gride-slider ">\n' +
                '        <a href="/movie/single/?movie_id='+ temp['id'] +'" class="hvr-sweep-to-bottom"><img src="'+ temp['url'] +'" title="Movies Pro"\n' +
                '                                                               class="img-responsive" alt=" "/>\n' +
                '            <div class="w3l-action-icon"><i class="fa fa-play-circle-o" aria-hidden="true"></i></div>\n' +
                '        </a>\n' +
                '        <div class="mid-1 agileits_w3layouts_mid_1_home">\n' +
                '            <div class="w3l-movie-text">\n' +
                '                <h6><a href="/movie/single/?movie_id='+ temp['id'] +'">'+ temp['movie_name'] +' </a></h6>\n' +
                '            </div>\n' +
                '            <div class="mid-2 agile_mid_2_home">\n' +
                '                <p>'+ temp['release_date'] +'</p>\n' +
                '                <div class="block-stars">\n' +
                '                    <ul class="w3l-ratings">\n'
               var s1,s2,s3;
        var score = Math.floor(temp['score']);
        s1 = Math.floor(score/2);
        s2 = score - s1*2;
        s3 = 5 - s1 - s2;
        for(var j=0; j<5; j++){
            if (s1>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star" aria-hidden="true"></i></a></li>\n';
                s1--;
            }
            else if(s2>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-half-o" aria-hidden="true"></i></a></li>\n';
                s2--;
            }
            else {
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-o" aria-hidden="true"></i></a></li>\n';
                s3--;
            }
        };
        htmltr = htmltr +
                '                    </ul>\n' +
                '                </div>\n' +
                '                <div class="clearfix"></div>\n' +
                '            </div>\n' +
                '        </div>\n' +
                '    </div>\n' +
                '</div></div>';
         $('.owl-wrapper').append(htmltr);
        }
        // Carousel.init();

    })
}

//热门电影
function hot_movie_show() {
    $.get('/movie/hot_movie/', {'type':'1'},function (data,status) {
    var jsonObj = JSON.parse(data);
    var movie = jsonObj['info'];
    $("#hot_movie1").html('');
    var temp = movie[0];
    var info = temp['information'];
    if(info.length>=100) info = info.substring(0, 99) + '...';
    var movie_name = temp['movie_name'];
    if(movie_name.length>=25) movie_name = movie_name.substring(0, 23) + '...';
    var htmltr = '  <a href="/movie/single/?movie_id='+ temp['id'] +'"> <div class="video-grid-single-page-agileits movie_click">\n' + '<span style="display: none;">'+ temp['id'] +'</span>' +
        '        <div data-video="f2Z65fobH2I" id="video" style="height: 510px; overflow: hidden; "><img\n' +
        '                src="'+ temp['url'] +'" alt=""\n' +
        '                class="img-responsive" /></div>\n' +
        '    </div></a>\n' +
        '    <div class="player-text">\n' +
        '        <p class="fexi_header">'+ movie_name +'</p>\n' +
        '        <p class="fexi_header_para"><span\n' +
        '                class="conjuring_w3">电影简介<label>:</label></span>'+ info +'</p>\n' +
        '        <p class="fexi_header_para"><span>上映日期<label>:</label></span>\n' +
        '            '+ temp['release_date'] +' </p>\n' +
       '        <p class="fexi_header_para"><span>导演<label>:</label></span>\n' +
        '            '+ temp['directors'] +'w</p>\n' +
        '        <p class="fexi_header_para fexi_header_para1">\n' +
        '            <span>评分<label>:</label></span>\n'
        var s1,s2,s3;
        var score = Math.floor(temp['score']);
        s1 = Math.floor(score/2);
        s2 = score - s1*2;
        s3 = 5 - s1 - s2;
        for(var j=0; j<5; j++){
            if (s1>0){
                htmltr = htmltr + '<a href="#"><i class="fa fa-star" aria-hidden="true"></i></a>\n';
                s1--;
            }
            else if(s2>0){
                htmltr = htmltr + '<a href="#"><i class="fa fa-star-half-o" aria-hidden="true"></i></a>\n';
                s2--;
            }
            else {
                htmltr = htmltr + '<a href="#"><i class="fa fa-star-o" aria-hidden="true"></i></a>\n';
                s3--;
            }
        };
        htmltr = htmltr +
        '        </p>\n' +
        '    </div>';
    $("#hot_movie1").append(htmltr);
    $("#hot_movies").html('');
    for (var i = 1; i <= 8; i++) {
        var temp = movie[i];
        var movie_name = temp['movie_name'];
        if(movie_name.length>=25) movie_name = movie_name.substring(0, 23) + '...';
        var htmltr = '<div class="w3l-movie-gride-agile movie_click">\n' + '<span style="display: none;">'+ temp['id'] +'</span>' +
            '        <a href="/movie/single/?movie_id='+ temp['id'] +'" class="hvr-sweep-to-bottom"><img src="'+ temp['url'] +'" title="Movies Pro"\n' +
            '                                                               class="img-responsive" alt=" " style=" width: 250px;height: 290px;">\n' +
            '            <div class="w3l-action-icon"><i class="fa fa-play-circle-o" aria-hidden="true"></i></div>\n' +
            '        </a>\n' +
            '        <div class="mid-1 agileits_w3layouts_mid_1_home">\n' +
            '            <div class="w3l-movie-text">\n' +
            '                <h6><a href="/movie/single/?movie_id='+ temp['id'] +'">'+ movie_name +'</a></h6>\n' +
            '            </div>\n' +
            '            <div class="mid-2 agile_mid_2_home">\n' +
            '                <p>'+ temp['release_date'] +'</p>\n' +
            '                <div class="block-stars">\n' +
            '                    <ul class="w3l-ratings">\n';
        var s1,s2,s3;
        var score = Math.floor(temp['score']);
        s1 = Math.floor(score/2);
        s2 = score - s1*2;
        s3 = 5 - s1 - s2;
        for(var j=0; j<5; j++){
            if (s1>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star" aria-hidden="true"></i></a></li>\n';
                s1--;
            }
            else if(s2>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-half-o" aria-hidden="true"></i></a></li>\n';
                s2--;
            }
            else {
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-o" aria-hidden="true"></i></a></li>\n';
                s3--;
            }
        };
        htmltr = htmltr + '                    </ul>\n' +
        '                </div>\n' +
        '                <div class="clearfix"></div>\n' +
        '            </div>\n' +
        '        </div>\n' +
        '        <div class="ribben">\n' +
        '            <p>HOT</p>\n' +
        '        </div>\n' +
        '    </div>';
        $("#hot_movies").append(htmltr);
            };

});
}

//热映电影信息展示
function new_movie_show() {
    $.get('/movie/hot_movie/', {'type':'0'},function (data,status) {
    var jsonObj = JSON.parse(data);
    var movie = jsonObj['info'];
    $("#new_movie1").html('');
    var temp = movie[0];
    var info = temp['information'];
    if(info.length>=100) info = info.substring(0, 99) + '...';
    var htmltr = '   <a href="/movie/single/?movie_id='+ temp['m2.id'] +'"> <div class="video-grid-single-page-agileits">\n' +
        '        <div data-video="f2Z65fobH2I" id="video" style="height: 510px; overflow: hidden; "><img\n' +
        '                src="'+ temp['url'] +'" alt=""\n' +
        '                class="img-responsive"/></div>\n' +
        '    </div></a>\n' +
        '    <div class="player-text">\n' +
        '        <p class="fexi_header">'+ temp['movie_name'] +'</p>\n' +
        '        <p class="fexi_header_para"><span\n' +
        '                class="conjuring_w3">电影简介<label>:</label></span>'+ info +'</p>\n' +
        '        <p class="fexi_header_para"><span>上映日期<label>:</label></span>\n' +
        '            '+ temp['release_date'] +' </p>\n' +
       '        <p class="fexi_header_para"><span>票房<label>:</label></span>\n' +
        '            '+ temp['box_office'] +'w</p>\n' +
        '        <p class="fexi_header_para fexi_header_para1">\n' +
        '            <span>评分<label>:</label></span>\n'
        var s1,s2,s3;
        var score = Math.floor(temp['score']);
        s1 = Math.floor(score/2);
        s2 = score - s1*2;
        s3 = 5 - s1 - s2;
        for(var j=0; j<5; j++){
            if (s1>0){
                htmltr = htmltr + '<a href="#"><i class="fa fa-star" aria-hidden="true"></i></a>\n';
                s1--;
            }
            else if(s2>0){
                htmltr = htmltr + '<a href="#"><i class="fa fa-star-half-o" aria-hidden="true"></i></a>\n';
                s2--;
            }
            else {
                htmltr = htmltr + '<a href="#"><i class="fa fa-star-o" aria-hidden="true"></i></a>\n';
                s3--;
            }
        };
        htmltr = htmltr +
        '        </p>\n' +
        '    </div>';
    $("#new_movie1").append(htmltr);
    $("#new_movies").html('');
    for (var i = 1; i <= 8; i++) {
        var temp = movie[i];
        var htmltr = '<div class="w3l-movie-gride-agile">\n' +
            '    <a href="/movie/single/?movie_id='+ temp['m2.id'] +'" class="hvr-sweep-to-bottom">    <img src="'+ temp['url'] +'" title="Movies Pro"\n' +
            '                                                               class="img-responsive" alt=" " style=" width: 250px;height: 290px;">\n' +
            '            <div class="w3l-action-icon"><i class="fa fa-play-circle-o" aria-hidden="true"></i></div>\n' +
            '       </a> \n' +
            '        <div class="mid-1 agileits_w3layouts_mid_1_home">\n' +
            '            <div class="w3l-movie-text">\n' +
            '                <h6><a href="/movie/single/?movie_id='+ temp['m2.id'] +'">'+ temp['movie_name'] +'</a></h6>\n' +
            '            </div>\n' +
            '            <div class="mid-2 agile_mid_2_home">\n' +
            '                <p>'+ temp['release_date'] +'</p>\n' +
            '                <div class="block-stars">\n' +
            '                    <ul class="w3l-ratings">\n'
           var s1,s2,s3;
        var score = Math.floor(temp['score']);
        s1 = Math.floor(score/2);
        s2 = score - s1*2;
        s3 = 5 - s1 - s2;
        for(var j=0; j<5; j++){
            if (s1>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star" aria-hidden="true"></i></a></li>\n';
                s1--;
            }
            else if(s2>0){
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-half-o" aria-hidden="true"></i></a></li>\n';
                s2--;
            }
            else {
                htmltr = htmltr + '<li><a href="#"><i class="fa fa-star-o" aria-hidden="true"></i></a></li>\n';
                s3--;
            }
        };
        htmltr = htmltr +
            '                    </ul>\n' +
            '                </div>\n' +
            '                <div class="clearfix"></div>\n' +
            '            </div>\n' +
            '        </div>\n' +
            '        <div class="ribben">\n' +
            '            <p>NEW</p>\n' +
            '        </div>\n' +
            '    </div>';
        $("#new_movies").append(htmltr);
            };

});
}